﻿using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using UnityEngine;

// Token: 0x020001B1 RID: 433
public class CharaCutActionSet
{
	// Token: 0x06000B42 RID: 2882 RVA: 0x000421C0 File Offset: 0x000403C0
	public CharaCutActionSet(Human human)
	{
		this.human = human;
	}

	// Token: 0x06000B43 RID: 2883 RVA: 0x000421E8 File Offset: 0x000403E8
	public void AddAct(CutAct_Anime act)
	{
		this.act_Animes.Add(act);
	}

	// Token: 0x06000B44 RID: 2884 RVA: 0x000421F8 File Offset: 0x000403F8
	public void AddAct(CutAct_Voice act)
	{
		this.act_Voices.Add(act);
	}

	// Token: 0x06000B45 RID: 2885 RVA: 0x00042208 File Offset: 0x00040408
	public void RemoveAct(CutAct_Anime act)
	{
		this.act_Animes.Remove(act);
	}

	// Token: 0x06000B46 RID: 2886 RVA: 0x00042218 File Offset: 0x00040418
	public void RemoveAct(CutAct_Voice act)
	{
		this.act_Voices.Remove(act);
	}

	// Token: 0x06000B47 RID: 2887 RVA: 0x00042228 File Offset: 0x00040428
	public void Sort()
	{
		List<CutAct_Anime> list = this.act_Animes;
		if (CharaCutActionSet.callback0 == null)
		{
			CharaCutActionSet.callback0 = new Comparison<CutAct_Anime>(CutScene.SortFunc);
		}
		list.Sort(CharaCutActionSet.callback0);
		List<CutAct_Voice> list2 = this.act_Voices;
		if (CharaCutActionSet.callback1 == null)
		{
			CharaCutActionSet.callback1 = new Comparison<CutAct_Voice>(CutScene.SortFunc);
		}
		list2.Sort(CharaCutActionSet.callback1);
	}

	// Token: 0x06000B48 RID: 2888 RVA: 0x00042288 File Offset: 0x00040488
	public void Check(float time)
	{
		this.Check_Anime(time);
	}

	// Token: 0x06000B49 RID: 2889 RVA: 0x00042294 File Offset: 0x00040494
	public void Check_Anime(float time)
	{
		Animator anime = this.human.body.Anime;
		anime.speed = 0f;
		if (this.act_Animes.Count != 0)
		{
			CutAct_Anime cutAct_Anime = null;
			CutAct_Anime cutAct_Anime2 = null;
			time = Mathf.Clamp(time, this.act_Animes[0].time, this.act_Animes[this.act_Animes.Count - 1].time);
			for (int i = 0; i < this.act_Animes.Count; i++)
			{
				if (this.act_Animes[i].time <= time)
				{
					cutAct_Anime = this.act_Animes[i];
				}
				if (this.act_Animes[i].time >= time)
				{
					cutAct_Anime2 = this.act_Animes[i];
					break;
				}
			}
			if (cutAct_Anime == cutAct_Anime2)
			{
				anime.Play(cutAct_Anime.state, 0, 0f);
			}
			else
			{
				float num = Mathf.InverseLerp(cutAct_Anime.time, cutAct_Anime2.time, time);
				float num2 = (cutAct_Anime2.time - cutAct_Anime.time) * num;
				float normalizedTime = 0f;
				anime.Play(cutAct_Anime.state, 0, normalizedTime);
			}
		}
	}

	// Token: 0x04000B95 RID: 2965
	public Human human;

	// Token: 0x04000B96 RID: 2966
	public List<CutAct_Anime> act_Animes = new List<CutAct_Anime>();

	// Token: 0x04000B97 RID: 2967
	public List<CutAct_Voice> act_Voices = new List<CutAct_Voice>();

	// Token: 0x04000B98 RID: 2968
	[CompilerGenerated]
	private static Comparison<CutAct_Anime> callback0;

	// Token: 0x04000B99 RID: 2969
	[CompilerGenerated]
	private static Comparison<CutAct_Voice> callback1;
}
